<?php

declare(strict_types=1);

namespace App\Marketing\Model;

use Hyperf\Database\Model\Relations\HasOne;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property \Carbon\Carbon $created_at 创建时间
 * @property int $task_id 任务id
 * @property int $user_id 用户id
 * @property string $date 日期
 * @property string $get_at 领取时间
 * @property-read null|MarketingTask $task 
 */
class MarketingTaskLog extends MineModel
{
    public const UPDATED_AT = null;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'marketing_task_log';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'created_at', 'task_id', 'user_id', 'date', 'get_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'created_at' => 'datetime', 'task_id' => 'integer', 'user_id' => 'integer'];

    public function task(): HasOne
    {
        return $this->hasOne(MarketingTask::class, 'id', 'task_id');
    }
}
